/**
 */
package proyecto.testcasetool.impl;

import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.ENotificationImpl;

import proyecto.testcasetool.RepeatBlock;
import proyecto.testcasetool.RepeatCondition;
import proyecto.testcasetool.TestcasetoolPackage;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Repeat Block</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link proyecto.testcasetool.impl.RepeatBlockImpl#getRepeatCondition <em>Repeat Condition</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class RepeatBlockImpl extends CompoundStepImpl implements RepeatBlock {
	/**
	 * The cached value of the '{@link #getRepeatCondition() <em>Repeat Condition</em>}' containment reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getRepeatCondition()
	 * @generated
	 * @ordered
	 */
	protected RepeatCondition repeatCondition;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected RepeatBlockImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	protected EClass eStaticClass() {
		return TestcasetoolPackage.Literals.REPEAT_BLOCK;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public RepeatCondition getRepeatCondition() {
		return repeatCondition;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public NotificationChain basicSetRepeatCondition(RepeatCondition newRepeatCondition, NotificationChain msgs) {
		RepeatCondition oldRepeatCondition = repeatCondition;
		repeatCondition = newRepeatCondition;
		if (eNotificationRequired()) {
			ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, TestcasetoolPackage.REPEAT_BLOCK__REPEAT_CONDITION, oldRepeatCondition, newRepeatCondition);
			if (msgs == null) msgs = notification; else msgs.add(notification);
		}
		return msgs;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setRepeatCondition(RepeatCondition newRepeatCondition) {
		if (newRepeatCondition != repeatCondition) {
			NotificationChain msgs = null;
			if (repeatCondition != null)
				msgs = ((InternalEObject)repeatCondition).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - TestcasetoolPackage.REPEAT_BLOCK__REPEAT_CONDITION, null, msgs);
			if (newRepeatCondition != null)
				msgs = ((InternalEObject)newRepeatCondition).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - TestcasetoolPackage.REPEAT_BLOCK__REPEAT_CONDITION, null, msgs);
			msgs = basicSetRepeatCondition(newRepeatCondition, msgs);
			if (msgs != null) msgs.dispatch();
		}
		else if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, TestcasetoolPackage.REPEAT_BLOCK__REPEAT_CONDITION, newRepeatCondition, newRepeatCondition));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
		switch (featureID) {
			case TestcasetoolPackage.REPEAT_BLOCK__REPEAT_CONDITION:
				return basicSetRepeatCondition(null, msgs);
		}
		return super.eInverseRemove(otherEnd, featureID, msgs);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
			case TestcasetoolPackage.REPEAT_BLOCK__REPEAT_CONDITION:
				return getRepeatCondition();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
			case TestcasetoolPackage.REPEAT_BLOCK__REPEAT_CONDITION:
				setRepeatCondition((RepeatCondition)newValue);
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eUnset(int featureID) {
		switch (featureID) {
			case TestcasetoolPackage.REPEAT_BLOCK__REPEAT_CONDITION:
				setRepeatCondition((RepeatCondition)null);
				return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public boolean eIsSet(int featureID) {
		switch (featureID) {
			case TestcasetoolPackage.REPEAT_BLOCK__REPEAT_CONDITION:
				return repeatCondition != null;
		}
		return super.eIsSet(featureID);
	}

} //RepeatBlockImpl
